﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using YKhoa_Lib.DAL;

namespace YKhoa_Lib.BLL
{
    public class ChiTiet_GoiKham
    {
        private int _id;
        public int ID
        {
            get { return _id; }
        }
        private int _maGK;
        public int MaGK
        {
            get { return _maGK; }
        }
        private string _maDV;
        public string MaDV
        {
            get { return _maDV; }
            set { _maDV = value; }
        }
        private string _maKhoa;
        public string MaKhoa
        {
            get { return _maKhoa; }
            set { _maKhoa = value; }
        }
        private string _tenDichVu;
        public string TenDichVu
        {
            set { _tenDichVu = value; }
            get { return _tenDichVu; }
        }
        private double _donGia;
        public double DonGia
        {
            get { return _donGia; }
        }

        private DAL_SoGoiKham dal_SoGK;
        public ChiTiet_GoiKham()
        {
            dal_SoGK = new DAL_SoGoiKham();
        }
        public List<ChiTiet_GoiKham> LayChiTietGoiKham(int maGK)
        {
            DataTable dt = dal_SoGK.LayChiTietGoiKham(maGK.ToString());
            List<ChiTiet_GoiKham> lst = new List<ChiTiet_GoiKham>();
            ChiTiet_GoiKham ctgk = null;
            foreach(DataRow row in dt.Rows)
            {
                ctgk = new ChiTiet_GoiKham();
                ctgk._maDV = Factory.emptyNull(row["MaDV"]);
                ctgk._tenDichVu = Factory.emptyNull(row["TenDichVu"]);
                ctgk._maKhoa = Factory.emptyNull(row["MaKhoa"]);
                ctgk._donGia = Factory.emptyNull(row["ThuPhi"]) != "" ? double.Parse(row["ThuPhi"].ToString()) : 0;
                lst.Add(ctgk);
            }
            return lst;
        }
    }
}
